home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20020314-20021006
/
000386_fdc@columbia.edu_Tue Sep 24 09:29:03 EDT 2002.msg
< prev
next >
Wrap
Text File
|
2002-10-06
|
4KB
|
110 lines
Article: 13722 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: scripting to a serial sms modem - idiot question!
Date: 24 Sep 2002 09:28:51 -0400
Organization: Columbia University
Lines: 93
Message-ID: <amppaj$rki$1@watsol.cc.columbia.edu>
References: <e516d9ec.0209160537.450ca7b@posting.google.com> <am9v0g$t1e$1@watsol.cc.columbia.edu> <e516d9ec.0209190043.6a2c8e0d@posting.google.com> <e516d9ec.0209240321.7d110c63@posting.google.com>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1032874133 4272 128.59.39.139 (24 Sep 2002 13:28:53 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 24 Sep 2002 13:28:53 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13722
In article <e516d9ec.0209240321.7d110c63@posting.google.com>,
Mark Swarbrick <mswarbrick@rentokil.com> wrote:
: I've had some more time to work on the sms project. The basic idea is
: to allow someone to text commands to the sms modem eg. 'uptime' and a
: text message sent back with the uptime. I've ordered the kermit book,
: but could use some help in the meantime with strings.
:
: ---------
: #!/usr/bin/kermit
:
: ; sets modem init stuff
:
: set line /dev/ttyS0
:
Need IF FAIL here...
: set speed 9600
: set carrier-watch off
: set input echo on
: lineout at
: input 20 ok
:
Need IF FAIL...
: lineout AT+CMGF=1
: input 20 ok
:
Need IF FAIL after every INPUT...
: ; queries modem for all messages
:
: lineout at+cmgs=?
: input 20 ok
: lineout at+cmgl="ALL"
: input 100 ok
:
: ; Loops msg by message extracting the number and message text into
: : two strings
: ; $msg $no
:
You have to be more specific if you want this translated into code.
Exactly what is a "number" and a "message"? Give a specific example.
How do you know where the end is?
: ; Depending on the text of the message perform external command which
: : includes modifying the response to fit in 160 chars eg sed / awk etc
: : store the reply in a string called reply_txt
:
You don't need an external command for that; Kermit can do it all by
itself.
: ; Execute the send message sms command using $no and $reply_txt strings
: : then loop to next message until there are no more, then delete all
: : messages from the modems memory
:
: ---------
:
: Does this sound about right? also how to i run a command and store the
: results in a string?
:
Again, you don't need to run external programs to manipulate strings.
Kermit has a full range of string manipulation functions. But to
answer your question:
\fcommand(command args)
runs the given command with the given string and returns its output so you
can use it, e.g.
assign foo \fcommand(uptime)
echo Uptime: \m(foo)
Type "help functions" to learn more about Kermit's built-in functions.
: in bash i'd just type uptime > uptime.txt. But
: can I have a clue how to do it in kermit? Then how to i write that
: string to a file?
:
Kermit has the full range of file i/o features:
http://www.columbia.edu/kermit/ckermit70.html#x1.22
Even though you don't have the book yet, you can learn a lot by studing
the tutorial and sample scripts here:
http://www.columbia.edu/kermit/ckscripts.html
and by reading the C-Kermit 7.0 and 8.0 release notes:
http://www.columbia.edu/kermit/ckermit70.html
http://www.columbia.edu/kermit/ckermit80.html
- Frank